﻿<Window x:Class="OmniKitsWindowsDemo.BindableSecurePasswordDemo"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:OmniKitsWindowsDemo"
        xmlns:ok="http://omnikits.codeplex.com/"
        mc:Ignorable="d"
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Title="BindableSecurePasswordDemo" Height="300" Width="300">
    <StackPanel>
        <PasswordBox x:Name="Password" 
                     ok:BindableSecurePassword.SecurePassword="{Binding SecurePassword, UpdateSourceTrigger=LostFocus}"
                     ok:BindableSecurePassword.AutoSync="True"
                     />
        <TextBlock Text="{Binding ElementName=Password, Path=(ok:BindableSecurePassword.SecurePassword).Length}"/>
        <TextBlock Text="{Binding SecurePassword.Length}"/>
        <CheckBox IsChecked="{Binding ElementName=Password, Path=(ok:BindableSecurePassword.AutoSync)}">Auto Sync</CheckBox>
        <CheckBox IsChecked="{Binding ElementName=Password, Path=(ok:BindableSecurePassword.AlwaysUpdateSource)}">Always Update Source</CheckBox>
        <Button Click="SetSecurePassword_Click">Set Secure Password</Button>
        <Button Click="SetSecurePasswordNull_Click">Set Secure Password to Null</Button>
    </StackPanel>
</Window>
